home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 June / EnigmA AMIGA RUN 08 (1996)(G.R. Edizioni)(IT)[!][issue 1996-06][EARSAN CD VII].iso / earcd / gcc / ixemlsdk.lha / include / netinet / in.h < prev    next >
C/C++ Source or Header  |  1996-03-13  |  4KB  |  143 lines

  1. /*
  2.  * Copyright (c) 1982, 1986 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that the above copyright notice and this paragraph are
  7.  * duplicated in all such forms and that any documentation,
  8.  * advertising materials, and other materials related to such
  9.  * distribution and use acknowledge that the software was developed
  10.  * by the University of California, Berkeley.  The name of the
  11.  * University may not be used to endorse or promote products derived
  12.  * from this software without specific prior written permission.
  13.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  14.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  15.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  16.  *
  17.  *    @(#)in.h    7.6 (Berkeley) 6/29/88
  18.  */
  19.  
  20. #ifndef NETINET_IN_H
  21. #define NETINET_IN_H
  22.  
  23. #include <machine/endian.h>
  24. /*
  25.  * Constants and structures defined by the internet system,
  26.  * Per RFC 790, September 1981.
  27.  */
  28.  
  29. /*
  30.  * Protocols
  31.  */
  32. #define    IPPROTO_IP        0        /* dummy for IP */
  33. #define    IPPROTO_ICMP        1        /* control message protocol */
  34. #define    IPPROTO_GGP        3        /* gateway^2 (deprecated) */
  35. #define    IPPROTO_TCP        6        /* tcp */
  36. #define    IPPROTO_EGP        8        /* exterior gateway protocol */
  37. #define    IPPROTO_PUP        12        /* pup */
  38. #define    IPPROTO_UDP        17        /* user datagram protocol */
  39. #define    IPPROTO_IDP        22        /* xns idp */
  40.  
  41. #define    IPPROTO_RAW        255        /* raw IP packet */
  42. #define    IPPROTO_MAX        256
  43.  
  44.  
  45. /*
  46.  * Ports < IPPORT_RESERVED are reserved for
  47.  * privileged processes (e.g. root).
  48.  * Ports > IPPORT_USERRESERVED are reserved
  49.  * for servers, not necessarily privileged.
  50.  */
  51. #define    IPPORT_RESERVED        1024
  52. #define    IPPORT_USERRESERVED    5000
  53.  
  54. /*
  55.  * Link numbers
  56.  */
  57. #define    IMPLINK_IP        155
  58. #define    IMPLINK_LOWEXPER    156
  59. #define    IMPLINK_HIGHEXPER    158
  60.  
  61. /*
  62.  * Internet address (a structure for historical reasons)
  63.  */
  64. struct in_addr {
  65.     u_long s_addr;
  66. };
  67.  
  68. /*
  69.  * Definitions of bits in internet address integers.
  70.  * On subnets, the decomposition of addresses to host and net parts
  71.  * is done according to subnet mask, not the masks here.
  72.  */
  73. #define    IN_CLASSA(i)        (((long)(i) & 0x80000000) == 0)
  74. #define    IN_CLASSA_NET        0xff000000
  75. #define    IN_CLASSA_NSHIFT    24
  76. #define    IN_CLASSA_HOST        0x00ffffff
  77. #define    IN_CLASSA_MAX        128
  78.  
  79. #define    IN_CLASSB(i)        (((long)(i) & 0xc0000000) == 0x80000000)
  80. #define    IN_CLASSB_NET        0xffff0000
  81. #define    IN_CLASSB_NSHIFT    16
  82. #define    IN_CLASSB_HOST        0x0000ffff
  83. #define    IN_CLASSB_MAX        65536
  84.  
  85. #define    IN_CLASSC(i)        (((long)(i) & 0xe0000000) == 0xc0000000)
  86. #define    IN_CLASSC_NET        0xffffff00
  87. #define    IN_CLASSC_NSHIFT    8
  88. #define    IN_CLASSC_HOST        0x000000ff
  89.  
  90. #define    IN_CLASSD(i)        (((long)(i) & 0xf0000000) == 0xe0000000)
  91. #define    IN_MULTICAST(i)        IN_CLASSD(i)
  92.  
  93. #define    IN_EXPERIMENTAL(i)    (((long)(i) & 0xe0000000) == 0xe0000000)
  94. #define    IN_BADCLASS(i)        (((long)(i) & 0xf0000000) == 0xf0000000)
  95.  
  96. #define    INADDR_ANY        (u_long)0x00000000
  97. #define    INADDR_BROADCAST    (u_long)0xffffffff    /* must be masked */
  98. #define    INADDR_NONE        0xffffffff        /* -1 return */
  99.  
  100. #define    IN_LOOPBACKNET        127            /* official! */
  101.  
  102. /*
  103.  * Socket address, internet style.
  104.  */
  105. #ifdef KERNEL
  106. struct TCP_sockaddr_in {
  107.     u_char    sin_len;
  108.     u_char    sin_family;
  109.     u_short sin_port;
  110.     struct    in_addr sin_addr;
  111.     char    sin_zero[8];
  112. };
  113. #endif
  114.  
  115. struct sockaddr_in {
  116.     short    sin_family;
  117.     u_short    sin_port;
  118.     struct    in_addr sin_addr;
  119.     char    sin_zero[8];
  120. };
  121.  
  122. /*
  123.  * Options for use with [gs]etsockopt at the IP level.
  124.  */
  125. #define    IP_OPTIONS    1        /* set/get IP per-packet options */
  126.  
  127. #ifdef KERNEL
  128. extern    struct domain inetdomain;
  129. extern    struct protosw inetsw[];
  130. struct    in_addr in_makeaddr();
  131. #endif
  132.  
  133. u_long inet_addr(const char *);
  134. u_long in_netof(const char *);
  135. int inet_aton(const char *, struct in_addr *);
  136. u_long in_lnaof(struct in_addr);
  137. struct in_addr inet_makeaddr(u_long, u_long);
  138. u_long inet_netof(struct in_addr);
  139. u_long inet_network(const char *);
  140. char *inet_ntoa(struct in_addr);
  141.  
  142. #endif /* NETINET_IN_H */
  143.